<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        div {
            text-align: center;
        }
    </style>
    <script>

        //核心练习题
        function CorePractice(){
            let heroNum = +prompt('请输入一个1到20的数字')
            let lineNum = Math.trunc(heroNum/5)
            let new_line_heroNum = heroNum%5 
            let hrml1 = ``
            let imgNameNum = 1
            for(let i = 0 ; i < lineNum; i++){
                let j = 0
                hrml1 += `<div>`
                while(j <5){  
                    hrml1 += `<img src="images/${imgNameNum}.webp" alt="${imgNameNum}">`
                    imgNameNum++
                    j++
                }
                hrml1 += `</div>`
            }
            hrml1 += `<div>`
            for(let i = 0; i < new_line_heroNum; i++){        
                hrml1 += `<img src="images/${imgNameNum}.webp" alt="${imgNameNum}">`
                imgNameNum++
            }
            hrml1 += `</div>`
            document.write(hrml1)
        }
        CorePractice()

    </script>
    <style>
        
    </style>
</head>
<body>

</body>
</html>